
#include "select.h"
#include <QGraphicsLineItem>

Select::Select(qreal x1, qreal y1, qreal x2, qreal y2):QGraphicsRectItem(x1,y1,x2-x1,y2-y1){
    m_start = new QPointF(x1,y1);
    m_end = new QPointF(x2,y2);

}

void
Select::setStart(qreal nx1, qreal ny1){
    m_start->setX(nx1);
    m_start->setY(ny1);
    QGraphicsLineItem temp(m_start->x(),m_start->y(),m_end->x(),m_end->y());
    setRect(temp.boundingRect());
}

void
Select::setEnd(qreal nx2,qreal ny2){
    m_end->setX(nx2);
    m_end->setY(ny2);
    QGraphicsLineItem temp(m_start->x(),m_start->y(),m_end->x(),m_end->y());
    setRect(temp.boundingRect());
}
